package com.skar.childtacker.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * User: Sergey Karyaka
 * Date: 08.12.13
 * Time: 21:42
 */
public class DbOpenHelper extends SQLiteOpenHelper {

    public static final String DB_NAME = "child_tracker";
    public static final int DB_VERSION = 1;

    public static final String TABLE_NAME_FEEDS = "feeds";
    public static final String CREATE_TABLE_FEED = "create table " + TABLE_NAME_FEEDS +
            " (id integer primary key, " +
            "start_date datetime default current_timestamp, " +
            "finish_date datetime default current_timestamp)";

    public DbOpenHelper(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
    }

    /**
     * create table if not exist
     *
     * @param db
     */
    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_TABLE_FEED);
    }

    /**
     * upgrade table if exists
     *
     * @param db
     * @param oldVersion
     * @param newVersion
     */
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
